<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="admin/public/layout">

<head>
    <title>积分设置</title>
</head>
<div  layout:fragment="content">
    <section class="content-header">
        <h1>
            积分设置
            <small>网站用户积分策略设置</small>
        </h1>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="callout callout-warning" th:if="${error}">
                    <h4>数据保存失败！</h4>
                    <ol>
                        <li  th:text="${error.message}"></li>
                    </ol>
                </div>
                <div class="box box-primary">
                    <form  th:object="${settingCreditAndCoinInfo}" role="form" name="addForm" method="POST" th:action="@{/admin/setting/credits}">
                        <input type="hidden" name="credit.id" th:value="${GlobalSetting.credit.id}"/>
                        <input type="hidden" name="coin.id" th:value="${GlobalSetting.coin.id}"/>
                        <div class="box-body">
                            <div class="alert alert-info" role="alert">经验和金币都可以设置为负数，0，或者正数，负数表示扣分</div>
                            <div class="table-responsive">
                                <table class="table table-bordered table-striped dataTable text-center">
                                    <thead>
                                    <tr role="row">
                                        <th>用户行为</th>
                                        <th>经验值</th>
                                        <th>金币数</th>
                                    </tr>
                                    </thead>

                                    <tbody>
                                    <tr>
                                        <td>用户注册获得</td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('credit.register')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="credit.register" th:value="${settingCreditAndCoinInfo.credit.register}" />
                                            </div>
                                        </td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('coin.register')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="coin.register" th:value="${settingCreditAndCoinInfo.coin.register}"/>
                                            </div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>每日登录系统获得</td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('credit.login')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="credit.login" th:value="${settingCreditAndCoinInfo.credit.login}" />
                                            </div>
                                        </td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('coin.login')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="coin.login" th:value="${settingCreditAndCoinInfo.coin.login}"/></div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>提出问题获得</td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('credit.ask')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="credit.ask" th:value="${settingCreditAndCoinInfo.credit.ask}" />
                                            </div>
                                        </td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('coin.ask')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="coin.ask" th:value="${settingCreditAndCoinInfo.coin.ask}" />
                                            </div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>回答问题获得</td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('credit.answer')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="credit.answer" th:value="${settingCreditAndCoinInfo.credit.answer}" />
                                            </div>
                                        </td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('coin.answer')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="coin.answer" th:value="${settingCreditAndCoinInfo.coin.answer}" />
                                            </div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>回答被采纳获得</td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('credit.adopted')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="credit.adopted" th:value="${settingCreditAndCoinInfo.credit.adopted}" />
                                            </div>
                                        </td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('coin.adopted')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="coin.adopted" th:value="${settingCreditAndCoinInfo.coin.adopted}" />
                                            </div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>撰写文章获得</td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('credit.writeArticle')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="credit.writeArticle" th:value="${settingCreditAndCoinInfo.credit.writeArticle}" />
                                            </div>
                                        </td>
                                        <td>
                                            <div th:class="${#fields.hasErrors('coin.writeArticle')}?'col-md-4 col-md-offset-4 has-error':'col-md-4 col-md-offset-4 '">
                                                <input type="text" class="form-control" name="coin.writeArticle" th:value="${settingCreditAndCoinInfo.coin.writeArticle}" />
                                            </div>
                                        </td>
                                    </tr>

                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary">保存</button>
                            <button type="reset" class="btn btn-success">重置</button>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </section>
</div>